package cn.xiaopeng.mcp.server.weixin.domain.service;

import cn.xiaopeng.mcp.server.weixin.domain.adapter.IWeixinPort;
import cn.xiaopeng.mcp.server.weixin.domain.model.WeixinSendMessageRequest;
import cn.xiaopeng.mcp.server.weixin.domain.model.WeixinSendMessageResponse;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Service;

import java.io.IOException;

/**
 * @author jiangyangang
 */
@Service
@Slf4j
public class WeiXinNoticeService {

    @Resource
    private IWeixinPort weixinPort;

    @Tool(description = "微信公众号通知")
    public WeixinSendMessageResponse weixinNotice(WeixinSendMessageRequest request) throws IOException {
        log.info("微信消息通知，平台:{} 主题:{} 描述:{}", request.getPlatform(), request.getSubject(), request.getDescription());
        return weixinPort.sendMessage(request);
    }
}
